package model

import "gorm.io/gorm"

type SelfBuildModel struct {
	gorm.Model
	ModelInfoID        uint   `gorm:"column:model_info_id;type:bigint;not null;uniqueIndex" json:"model_info_id"`
	ModelName          string `gorm:"column:model_name;type:varchar(255)" json:"model_name"`
	ContainerImage     string `gorm:"column:container_image;type:varchar(255)" json:"container_image"`
	ContainerPort      int    `gorm:"column:container_port;default:8080" json:"container_port"`
	MemoryRequirements string `gorm:"column:memory_requirements;type:varchar(50)" json:"memory_requirements"`
	GpuRequirements    string `gorm:"column:gpu_requirements;type:varchar(50)" json:"gpu_requirements"`

	ModelInfo ModelInfo `gorm:"foreignKey:ModelInfoID" json:"model_info"`
}

func (SelfBuildModel) TableName() string {
	return "self_build_model"
}

func (sbm *SelfBuildModel) BaseUrl(host string) string {
	return "http://" + host + ":" + string(rune(sbm.ContainerPort)) + "/v1"
}
